<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl() ;?>/css/danhmuc.css" media="screen" />
<script src="<?php echo $this->baseUrl() ;?>/scripts/danhmuc.js" type="text/javascript"></script>
<script src="<?php echo $this->baseUrl() ;?>/scripts/tooltip/wz_tooltip.js"></script>

<div class ="conten" >

    <table cellpadding="0"  cellspacing="0" class="tableconten" border="0">
        <tr>
            <td class="left_conten" >
            <!-- left  -->
               <div class="module-left">
                      <div class="t_m">
            			<div class="t_r">
            				<h3>
                                Tạo mới 
            					<a class="toggleicon" href='#'><div onclick="slidetoggle('99')" class='shboxs99 show'><img src="<?php echo $this->baseUrl() ;?>/images/box/down1.png" /></div><div onclick="hslidetoggle('99')" class='hshboxs99 hidden'><img src="<?php echo $this->baseUrl() ;?>/images/box/down2.png" /></div></a>
            				</h3>
            				
            			</div>
            		  </div>
            		  <div id="box99" class="module-content">
            			<ul>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-new_01.png" /><a href="<?php echo $this->baseUrl()?>/thumau/themthumau"   >Thêm thư mẫu  </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-new_01.png" /><a href="<?php echo $this->baseUrl()?>/lienhe/">Thêm liên hệ</a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-new_01.png" /><a href=""> Gửi thư </a></li>
            				
            			</ul>
            		  </div>
            		  <div class="module-bottom">
            			<div class="md-bt-r"><div class="md-bt-l">&nbsp;</div></div>
            		  </div>	                  
               </div>
               
               <!-- thao tac 2 -->
               
               <div class="module-left">
                      <div class="t_m">
            			<div class="t_r">
            				<h3> 
                                Danh Sách
            					<a class="toggleicon" href='#'><div onclick="slidetoggle('98')" class='shboxs98 show'><img src="<?php echo $this->baseUrl() ;?>/images/box/down1.png" /></div><div onclick="hslidetoggle('98')" class='hshboxs98 hidden'><img src="<?php echo $this->baseUrl() ;?>/images/box/down2.png" /></div></a>
            				</h3>
            				
            			</div>
            		  </div>
            		  <div id="box98" class="module-content">
            			<ul>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/thunhap/"   >Danh sách thư nháp </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/thumau/index/"   >Danh sách thư mẫu </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/lienhe/" >Danh Sách liên hệ</a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/thudagui/" > Danh sách thư đã gửi </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/danhmuc/" > Danh mục thư </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/tukhoa/" > Danh mục từ khóa </a></li>
            				
            			</ul>
            		  </div>
            		  <div class="module-bottom">
            			<div class="md-bt-r"><div class="md-bt-l">&nbsp;</div></div>
            		  </div>	                  
               </div>           
               
            <!--  end left--> 
             </td>
            <td class="right_conten" >
            <div class="bao_benphai">
            <!-- right  -->
                <!-- breadcrumd-->
    			<div class="breadcrum" >
    				<ul>
    					<li class="home"><a href="<? echo $this->baseUrl()?>/danhmuc/">Danh mục</a></li>
    					<li class="br_item"><span>Danh sách danh mục</span></li>
    				</ul>
    			</div>
		    	<!-- end breadcrumd-->
		    	
		    	<!--  Start Thêm thư   -->
                
                     <form action="<?php echo $this->baseUrl() ?>/danhmuc/index/" method="post" >
                     <div class="timkem_list"> 
                          <div class="divthaotac" title="Xóa Danh Mục" align="center"> 
	                            <a href="#" onclick="xoanhieudanhmuc()">
	                            	 <span class="xoatoanbo"></span>
	                            	Sọt rác  
	                            </a>
                          </div>
                         <div class="divthaotac" title="Thêm Danh Mục"  align="center"> 
	                            <a href="#" onclick="themmoidanhmuc()">
	                            	 <span class="themmoi"></span>
	                            	Thêm mới  
	                            </a>
                          </div>
                         
                            <!-- Ket qua trả về --> 
                            <div class="suggestionsBox">
                               <div class="suggestionList">                            
                               </div> 
                            </div>
                            <!-- Ket qua trả về --> 
                            
                     </div>
                    </form>
                     <!-- End Tìm kiếm  -->   
                
					<div class="box-l-n" style="clear: both;">
						<div class="box-l-n-l">
							<div class="box-l-n-r">
								<div class="box-l-n-m" align="left"> <div class="xoa_botton"><input onclick="xoanhieuthumau()" type="button" value="Xóa" class="delete" />    </div> <h3  >Danh sách thư mẫu </h3></div>
							</div>
						</div>
					<div class="box-l-n-body">
						<div class="box-l-n-wrr">
						<form id="danhsachthumau" action="">
		    			<table cellspacing="1" id="danh_sachthu">
							<thead>
							<tr align="center">
								<td width="2%" ><input id="check" type="checkbox" onclick="selectReverse('danhsachthumau','tmid')" style="width: 50px" /></td>
								<th width="30%" ><b>Tên danh mục </b></th>
								<td width="6%" align="center">Xắp xếp </td>
								<td width="12%"><b>Ngày tạo</b></td>
								<td width="12%"><b>Ngày sửa</b></td>
								<td width="8%" ><b>Sử dụng</b></td>
								<td  width="6%"><b>Thao tác</b></td>
							</tr>
							</thead>
							<tbody>
							<?php foreach ($this->danhmuc as $danhmuc ){?>
							<tr class="row_<?php echo  $danhmuc['id'] ?>">
								<td align="center" ><input type="checkbox" id="tmid_" value="<?php echo  $danhmuc['id'] ?>" name="listdm[]"/></td>
								<td width="30%" >
									<input type="hidden" id="company" value="" />
									<a href="#">
										<span onclick="suadanhmuc('<?php echo $danhmuc['id'] ?>')"> <b><?php echo $danhmuc['ten_loai_thu'] ?></b></span>									
									</a>
								</td>
								<td width="6%" align="center">
									<?php echo $danhmuc['sap_xep']?>
								</td>								
								<td width="12%" align="center">
									<?php echo $danhmuc['ngay_tao']?>
								</td>
								<td  width="12%" align="center">
									<?php echo $danhmuc['ngay_sua']?>	
								</td>
								<td align="center" width="8%">
									<?php if($danhmuc['su_dung'] =="1"){ ?>
										<samp id='thu_mau_<?php echo $danhmuc['id']?>'><a href="#" onclick="khongsudungdanhmuc('<?php echo $this->iddangnhap;?>','<?php echo $danhmuc['id'] ?>','0');" >  
											<img title="Không sử dụng danh mục này" src="<?php echo $this->baseUrl() ?>/images/icon/check2.png"  width="17" hight="17" />
										</a></samp>	 
									<?php }else {?>
										<samp id='thu_mau_<?php echo $danhmuc['id']?>'><a href="#" onclick="sudungdanhmuc('<?php echo $this->iddangnhap;?>','<?php echo $danhmuc['id'] ?>','1');" >  
											<img title="Sử dụng danh mục này" src="<?php echo $this->baseUrl() ?>/images/icon/notice-alert.png"  width="17" hight="17" />
										</a></samp>
										
									<?php }?>
								</td>
								<td align="center">
									<a href="#"><span onclick="suadanhmuc('<?php echo $danhmuc['id'] ?>')"><img class="icons" title="Sửa danh mục" src="<?php echo $this->baseUrl() ?>/images/icon/page_white_edit.png"></span></a>
									<span onclick="xoadanhmuc('<?php echo $danhmuc['id'] ?>')"><img class="icons" title="Xóa danh mục" src="<?php echo $this->baseUrl() ?>/images/icon/icon-16-delete.png"></span>
								</td>
							</tr>
								<?php }?>				
							</tbody>
						</table>
						</form>
						
						</div>
					</div>
			   </div>
			
				<input type="hidden" value="<?php echo $this->baseUrl()?>" id="url"/>
				<input type="hidden" value="<?php echo $this->iddangnhap;?>" id="iddn"/>
		    	<!--  End them thư  -->
		    	
		    </div>	
            <!-- right -->
            </td>
            
        </tr>
    
    </table>
</div>

<!-- Thêm mới danh mục -->

<div id="themmoidanhmuc" title="Thêm danh mục mới" style="display:none;">
	<form  method="post" action="<?php echo $this->baseUrl()?>/danhmuc/themdanhmuc" id="form_themdanhmuc" onsubmit="return checkdanhmuc();" >
	<div class="sectionFrm"> Thêm danh mục </div>
		    		<!--  Bên trái -->
		    		<div class="left_conten_form" style="width:100% !important;" >
		    			<div class="eleRow">
		    				<div class="eleCaption">Tên danh mục </div>
		    				<div class="eleBody">
		    					<input type="text" name="tendanhmuc" id="tendanhmuc" class="required"  /><span class="redtext">*</span>
		    				</div>
		    			</div>
		    			<div class="eleRow">
		    				<div class="eleCaption">Sắp xếp </div>
		    				<div class="eleBody">
		    					<input type="text" name="sapxep" id="sapxep" class="required" style="width:30px"  />
		    				</div>
		    			</div>		    			
		    			<div class="eleRow">
		    				<div class="eleCaption">Người tạo</div>
		    				<div class="eleBody">
		    					<input type="text" name="nguoitao" id="nguoitao" disabled="disabled"  value="<?php echo $this->name?>"/>
		    				</div>
		    				
		    			</div>		    				
		    			<div class="eleRow">
		    				<div class="eleCaption">Ngày tạo</div>
		    				<div class="eleBody">
		    					<input type="text" disabled="disabled" value="<?php echo $this->today; ?>"/>
		    				</div>
		    				
		    			</div>			    			
			    						    						    		
		    		</div>
		    		<!--  end ben phai -->
		    		
		    		<!--  Phan day  -->
			           <div align="center" class="day_them">
				          <span class="bottomday">
				           <input type="hidden" value="<?php echo $this->baseUrl()?>" id="urlsua"/>
				           <input type="hidden" value="<?php echo $this->iddangnhap ?>" name="iddn" id="iddn"/>
			               <input type="submit" class="save" value="Lưu lại" style="width:100px;" />
			           	   <input type="button" style="width:100px;" value="Hủy bỏ" class="save" onclick="closethemdm()">
			           	  </span>
			            </div>  		    		
		    		<!-- end Phan day  -->
		    </form>	

</div>

<!-- Sửa danh mục -->
<div id="suadanhmuc" title="Sửa danh mục " style="display:none;">
	<form  method="post" action="<?php echo $this->baseUrl()?>/danhmuc/suadanhmuc" id="form_danhmucsua" onsubmit="return checksuadanhmuc();" >
	<div class="sectionFrm"> Sửa danh mục </div>
		    		<!--  Bên trái -->
		    		<div class="left_conten_form"  style="width:100% !important;" >
		    			<div class="eleRow">
		    				<div class="eleCaption">Tên danh mục </div>
		    				<div class="eleBody">
		    					<input type="text" name="tendanhmucsua" id="tendanhmucsua" class="required" /><span class="redtext">*</span>
		    				</div>
		    			</div>
		    			<div class="eleRow">
		    				<div class="eleCaption">Sắp xếp </div>
		    				<div class="eleBody">
		    					<input type="text" name="sapxep" id="sapxep_sua" class="required" style="width:30px"  />
		    				</div>
		    			</div>			    			
		    			<div class="eleRow">
		    				<div class="eleCaption">Người tạo</div>
		    				<div class="eleBody">
		    					<input type="text" name="nguoitaosua" id="nguoitaosua" disabled="disabled"  value="<?php echo $this->name?>"/>
		    				</div>
		    				
		    			</div>		    				
		    			<div class="eleRow">
		    				<div class="eleCaption">Ngày tạo</div>
		    				<div class="eleBody">
		    					<input type="text"  id='ngay_tao_sua' disabled="disabled" />
		    				</div>
		    				
		    			</div>
		    			<div class="eleRow">
		    				<div class="eleCaption">Ngày cập nhật</div>
		    				<div class="eleBody">
		    					<input type="text" disabled="disabled" value="<?php echo $this->today; ?>"/>
		    				</div>
		    				
		    			</div>
			    						    						    		
		    		</div>
		    		<!--  end ben phai -->
		    		
		    		<!-- Phan day  -->
			           <div align="center" class="day_them">
				          <span class="bottomday"> 
				           <input type="hidden" value="<?php echo $this->iddangnhap ?>" name="iddnsua" id="iddnsua"/>
				           <input type="hidden" name="iddmsua" id="iddmsua"/>
			               <input type="submit" class="save" value="Lưu lại" style="width:100px;" />
			           	   <input type="button" style="width:100px;" value="Hủy bỏ" class="save" onclick="closesuadm()">
			           	  </span>
			            </div>  		    		
		    		<!-- end Phan day  -->
		    </form>	

</div>

